/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @Title: RxBaseContent
 * @Package com.rx.core.base
 * @Description: 上下文父类
 * @author: 陈锦韬
 * @date: 2021\6\25 0025
 * @version V1.0
 * @Copyright: 2021 陈锦韬  All rights reserved.
 */
package com.rx.core.base;

import com.rx.core.bean.LoginUserInfo;
import com.rx.core.iface.RxContent;
import com.rx.core.util.EmptyChecker;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: Administrator
 * @Description: 上下文父类
 * @date: 2021\6\25 0025
 */
@Data
public class RxBaseContent implements RxContent {
    RxBaseData rxBaseData;
    LoginUserInfo userInfo;
    Map<String,Object> variable;

    private Map<String,Object> getTmpVariable(){
        if (EmptyChecker.isEmpty(variable)){
            variable = new HashMap<>();
        }
        return variable;
    }
    @Override
    public Object getVar(String key){
        return getTmpVariable().get(key);
    }
    @Override
    public void setVar(String key,Object object){
        getTmpVariable().put(key,object);
    }

    @Override
    public LoginUserInfo getUserInfo() {
        return userInfo;
    }

    @Override
    public void setUserInfo(LoginUserInfo loginUserInfo) {
        this.userInfo=loginUserInfo;
    }
}
